package countdownlatch;

import java.util.concurrent.CountDownLatch;

/**
 * Created by L.jp
 * Description:
 * User: 86189
 * Date: 2022-08-08
 * Time: 14:00
 */
public class MotherThread extends Thread{
    private CountDownLatch countDownLatch;
    public MotherThread(CountDownLatch countDownLatch) {
        this.countDownLatch=countDownLatch;
    }
    
    @Override
    public void run() {
        try {
            //等待孩子线程吃完饺子
            //当计数器变成0的时候，会自动唤醒这里等待的线程。
            countDownLatch.await();
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        System.out.println("收拾碗筷");
    }
}
